#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;


class Solution {
public:
    string reverseWords(string s)
    {
        int len = s.length(), start = 0;
        for (int i = 0; i <= len; i++)
        {
            if (i == len || s[i] == ' ')
            {
                reverse(s.begin() + start, s.begin() + i);
                start = i + 1;
            }
        }
        return s;
    }
};